#!/bin/bash

# This script is used to retrieve information about HMC
# Initially it will ony get the Serial Number, more can be added in later

getopt -Qn 'Error' hs

export CLASSPATH=/usr/websm/codebase/pluginjars/hmcdebug.jar:/opt/hsc:/usr/websm/codebase/pluginjars/sniacimom.jar:/usr/websm/codebase/pluginjars/xerces.jar:/usr/websm/codebase/pluginjars/HwmcaCommon.jar:/usr/websm/codebase/pluginjars/auifw.jar:$CLASSPATH
export PATH=/opt/IBMJava2-13/jre/bin:$PATH

if [ $# -eq 0 ];
then echo
echo usage: getHMCInfo -s '     ' lists the serial number of the Console
echo
echo Options:
echo '   ' -h brings up this help screen
echo
exit 1
fi
if [ $1 = '--help' ];
then echo
echo usage: getHMCInfo -s '     ' lists the serial number of the Console
echo
echo Options:
echo '   ' -h brings up this help screen
echo
exit 0
fi

sn=`/opt/hsc/bin/HSCDoCmd java -Djavax.net.ssl.keyStore=/usr/websm/codebase/SM.pubkr -Djavax.net.ssl.keyStorePassword=defp -DcimomConfigFile=/opt/hsc/data/cimomcfg.properties com.ibm.hsc.common.util.HSCVPD | grep "Serial No" | cut -f 2 -d ':' 2>/dev/null`
echo $sn
exit $?
